package product;

import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class ProductMain extends JFrame {
	
	ProductMain1 pm1 ;
	ProductMain2 pm2 ;
	ProductMain3 pm3 ;
	ProductMain4 pm4 ;
	ProductMain5 pm5 ;
	
	
	public JDesktopPane contentPane;
	private JMenuBar menuBar;
	private JMenu mnNewMenu_1;
	private JMenuItem mntmNewMenuItem_2;
	private JMenuItem mntmNewMenuItem_3;
	private JMenuItem mntmNewMenuItem_6;
	private JMenuItem mntmNewMenuItem_7;
	private JMenuItem mntmNewMenuItem_8;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			@Override
			public void run() {
				try {
					ProductMain frame = new ProductMain();
					UIManager.put("InternalFrame.titleFont", new Font("Gulim", Font.PLAIN, 11));
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ProductMain() {
		setTitle("Product Main Ver 0.5");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 900, 800);
		setJMenuBar(getMenuBar_1());
		contentPane = new JDesktopPane();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
	}
	private JMenuBar getMenuBar_1() {
		if (menuBar == null) {
			menuBar = new JMenuBar();
			menuBar.add(getMnNewMenu_1());
		}
		return menuBar;
	}
	private JMenu getMnNewMenu_1() {
		if (mnNewMenu_1 == null) {
			mnNewMenu_1 = new JMenu("조별 프로젝트");
			mnNewMenu_1.add(getMntmNewMenuItem_2());
			mnNewMenu_1.add(getMntmNewMenuItem_3());
			mnNewMenu_1.add(getMntmNewMenuItem_6());
			mnNewMenu_1.add(getMntmNewMenuItem_7());
			mnNewMenu_1.add(getMntmNewMenuItem_8());
		}
		return mnNewMenu_1;
	}
	private JMenuItem getMntmNewMenuItem_2() {
		if (mntmNewMenuItem_2 == null) {
			mntmNewMenuItem_2 = new JMenuItem("1조(급여관리)");
			mntmNewMenuItem_2.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					if(pm1 == null){
						pm1 = new ProductMain1();
						contentPane.add(pm1);
						pm1.setBounds(100, 100, 600, 450);
					}
					pm1.setVisible(true);
				}
			});
		}
		return mntmNewMenuItem_2;
	}
	private JMenuItem getMntmNewMenuItem_3() {
		if (mntmNewMenuItem_3 == null) {
			mntmNewMenuItem_3 = new JMenuItem("2조(재고관리)");
			mntmNewMenuItem_3.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e){
					try{
					if(pm2 == null){
						pm2 = new ProductMain2();
						UIManager.setLookAndFeel("com.jtattoo.plaf.hifi.HiFiLookAndFeel");
						SwingUtilities.updateComponentTreeUI(pm2);
						contentPane.add(pm2);
						pm2.setBounds(0, 0,800,700);
					}
					pm2.setVisible(true);
					}catch(Exception ex){
						ex.printStackTrace();
					}
				}
			});
		}
		return mntmNewMenuItem_3;
	}
	private JMenuItem getMntmNewMenuItem_6() {
		if (mntmNewMenuItem_6 == null) {
			mntmNewMenuItem_6 = new JMenuItem("3조(사원관리)");
			mntmNewMenuItem_6.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					if(pm3 == null){
						pm3 = new ProductMain3();
						contentPane.add(pm3);
						pm3.setBounds(100, 100, 1002, 693);
					
					}
					pm3.setVisible(true);
				}
			});
		}
		return mntmNewMenuItem_6;
	}
	private JMenuItem getMntmNewMenuItem_7() {
		if (mntmNewMenuItem_7 == null) {
			mntmNewMenuItem_7 = new JMenuItem("4조(거래처관리)");
			mntmNewMenuItem_7.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					if(pm4 == null){
						pm4 = new ProductMain4();
						contentPane.add(pm4);
						pm4.setBounds(10, 40, 1580, 769);
					}
					pm4.setVisible(true);

				}
			});
		}
		return mntmNewMenuItem_7;
	}
	private JMenuItem getMntmNewMenuItem_8() {
		if (mntmNewMenuItem_8 == null) {
			mntmNewMenuItem_8 = new JMenuItem("5조(판매관리)");
			mntmNewMenuItem_8.addActionListener(new ActionListener(){
				@Override
				public void actionPerformed(ActionEvent e) {
					if(pm5 == null){
						pm5 = new ProductMain5();
						contentPane.add(pm5);
						pm5.setBounds(100, 100, 1050, 600);
					}
					pm5.setVisible(true);
				}
			});
		}
		return mntmNewMenuItem_8;
	}
}
